#ifndef  SHINYEXCEPTION_HPP
# define SHINYEXCEPTION_HPP

# include <string>
# include <iostream>

namespace sf
{
  class RenderWindow;
}
namespace Shiny
{
  struct Exception
  {
    Exception(const std::string sender, const std::string message, unsigned short code)
       : _sender(sender), _originalMessage(message), _messageCode(code)
    {
    }

    virtual ~Exception() {};

    const std::string&   Sender(void) const { return (_sender); }
    unsigned short       Code(void) const   { return (_messageCode); }

    virtual void Output(std::ostream& output) const
    {
      output << "/!\\ " << _sender << " crashed [code " << _messageCode << "] -> " << _originalMessage;
    }
    
    void Display(sf::RenderWindow& target);

    const std::string    _sender;
    const std::string    _originalMessage;
    const unsigned short _messageCode;
  };

  struct FileException : public Exception
  {
    FileException(const std::string sender,
                  const std::string message,
		  unsigned short    code,
		  unsigned short    line) : Exception(sender, message, code)
    {
      _errorLine = line;
    }
    
    virtual void Output(std::ostream& output) const
    {
      Exception::Output(output);
      output << ", at line " << _errorLine;
    }

    unsigned short _errorLine;
  };
}

#endif
